define(function(require){
    var main =require('/static/main.js');
    var m = new main();
    function Cont(){
        this.Fun._init();
    }
    Cont.prototype.Fun = {
        _init:function(){
            this.getlist();
            this.bindEvent();
        },
        bindEvent:function(){
        },
        getlist:function(){
            var param = {};
            var sort = 0;
            var table = $('#datatable').dataTable({
                'ordering':false,
                "serverSide": true,
                "searching":false,
                'bLengthChange': false,
                'bPaginate': true,
                "bDestory": true,
                "bRetrieve": true,
                "bFilter":false,
                "bSort": false,
                "bProcessing": true,
                "autoWidth": false,
                ajax: function (data, callback, settings) {
                    //封装请求参数
                    param.PageSize = data.length;//页面显示记录条数，在页面显示每页显示多少项的时候
                    param.start = data.start;//开始的记录序号
                    param.PageNo = (data.start / data.length)+1;//当前页码
                    sort = (param.PageNo-1)*param.PageSize;
                    //ajax请求数据
                    $.ajax({
                        type: "POST",
                        url: "/financeplatform/get-account-record-list",
                        cache: false,  //禁用缓存
                        data: param,  //传入组装的参数
                        dataType: "json",
                        success: function (result) {
                            var returnData = {};
                            returnData.draw = data.draw;
                            returnData.recordsTotal = result.total;
                            returnData.recordsFiltered = result.total;
                            returnData.data = result.data;
                            callback(returnData);
                        }
                    });
                },
                "aoColumns":[
                    {"mDataProp": 'Amount',
                        render:function(data){
                            return data > 0? '+'+data : data;
                        }
                    },
                    {"mDataProp": 'CurrentAmount'},
                    {"mDataProp": 'AccountRecType',
                        render:function(data){
                            return data == 1100 ? '销售产品收益' :'提现支出';
                        }
                    },
                    {"mDataProp": 'AccountRecStatus',
                        render:function(data){
                            var AccountRecStatus = '';
                            switch(data){
                                case 1100:AccountRecStatus = '审核中'; break;
                                case 1200:AccountRecStatus = '审核成功'; break;
                                case 1300:AccountRecStatus = '审核失败'; break;
                                case 1400:AccountRecStatus = '成功'; break;
                                case 1500:AccountRecStatus = '失败'; break;
                                case 1600:AccountRecStatus = '冻结'; break;
                                case 2000:AccountRecStatus = '成功'; break;
                            }
                            return AccountRecStatus;
                        }
                    },
                    {"mDataProp": 'Comment'},
                    {"mDataProp": 'CreateTime',
                        render:function(data){
                            return m.formatTimeAll2(data);
                        }
                    },
                ]
            }).api();
        }


    }
    var a = new Cont();

})